package model

import (
	"gorm.io/gorm"
	"time"
)

type BaseModel struct {
	ID        int32 `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
	IsDeleted bool
}

type User struct {
	BaseModel
	Mobile   string     `gorm:"index:idx_mobile;unique;type:varchar(11);not null" json:"mobile"`
	Password string     `gorm:"type:varchar(100);not null" json:"password"`
	NickName string     `gorm:"type:varchar(20);not null" json:"nick_name"`
	Birthday *time.Time `gorm:"type:datetime;not null" json:"birthday"`
	Gender   string     `gorm:"default:male;type:varchar(6); comment:'female 女, male男'" json:"gender"`
	Role     int        `gorm:"default:1;type:int; comment:'1普通用户 2管理员'" json:"role"`
}
